<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<title>Bloomberg Development Environment</title>
<html>
<pre>
// Copyright 2021-2023 Bloomberg Finance L.P.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// bmqpi_hosthealthmonitor.h                                          -*-C++-*-
#ifndef INCLUDED_BMQPI_HOSTHEALTHMONITOR
#define INCLUDED_BMQPI_HOSTHEALTHMONITOR

//@PURPOSE: Provide an interface for monitoring the health of the host.
//
//@CLASSES:
//  bmqpi::HostHealthMonitor: Interface for a monitor of host health.
//
//@DESCRIPTION:
// &#39;bmqpi::HostHealthMonitor&#39; is a pure interface for a monitor of the health
//   of the host. BlazingMQ sessions can use such objects to conditionally
//   suspend queue activity while the host is marked unhealthy.


// BMQ
#include &lt;bmqscm_version.h&gt;
#include &lt;bmqt_hosthealthstate.h&gt;

// BDE
#include &lt;bsl_functional.h&gt;
#include &lt;bdlmt_signaler.h&gt;

namespace BloombergLP {
namespace bmqpi {

                           // =======================
                           // class HostHealthMonitor
                           // =======================

class HostHealthMonitor {
    // A pure interface for monitoring the health of the host.

  public:
    // TYPES
    typedef bsl::function&lt;void(bmqt::HostHealthState::Enum)&gt;
        HostHealthChangeFn;
        // Invoked as a response to the HostHealthMonitor detecting a change
        // in the state of the host health.

  public:
    // CREATORS
    virtual
    ~HostHealthMonitor();
        // Destructor

    // MANIPULATORS
    virtual
    bdlmt::SignalerConnection
    observeHostHealth(const HostHealthChangeFn&amp; cb) = 0;
        // Registers the specified `cb` to be invoked each time the health of
        // the host changes.

    // ACCESSORS
    virtual
    bmqt::HostHealthState::Enum hostState() const = 0;
        // Queries the current health of the host.
};

}  // close package namespace
}  // close enterprise namespace

#endif
</pre>
</body>
</html>
